/*
 * Copyright (c) 2007
 *	Alberto Magni, Maggioni Marcello
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 */


package Database;

import exceptions.DatabaseException;

/**
 * ConfigurationDB is an interface that specifies methods for the management of the Database of the configuration
 * 
 * @author Marcello Maggioni
 */
public interface ConfigurationDB {
    /**
     * This method is used to set the server used by the username specified as parameter
     * 
     * @param username The username of the user for which the server needs to be configured
     * @param server The URL of the server
     * @throws exceptions.DatabaseException
     */
    public void setServer(String username, String server) throws DatabaseException;
    /**
     * This method is used to set the email address of the user specified by the username passed as parameter
     * 
     * @param username The username of the user for which the email address needs to be configured
     * @param email The email address
     * @throws exceptions.DatabaseException
     */
    public void setEMailAddress(String username, String email) throws DatabaseException;
    /**
     * This method is used to get the server configured for the username specified as parameter
     *  
     * @param username The username
     * @return The server for the specified username
     * @throws exceptions.DatabaseException
     */
    public String getServer(String username) throws DatabaseException;
    /**
     * This method is used to get the email address configured for the specified username 
     * 
     * @param username The username
     * @return The email address configured for the specified username
     * @throws exceptions.DatabaseException
     */
    public String getEMailAddress(String username) throws DatabaseException;
    /**
     * This method is used to set in the configuration the flag to enable or disable the spam check
     * 
     * @param username The username for configuration
     * @param value The value of the spamcheck flag
     * @throws exceptions.DatabaseException
     */
    public void setSpamCheck(String username, boolean value) throws DatabaseException;
    /**
     * This method is used to get the value of the configuration flag of the spam check
     * 
     * @param username The username for which we want to check the value of the spamcheck flag
     * @return The value of the flag
     * @throws exceptions.DatabaseException
     */
    public boolean getSpamCheck(String username) throws DatabaseException;
     /**
     * This method is used to set the value of the configuration flag of the for the server authentication mode
     * 
     * @param username The username for which we want to set the value of the the server authentication mode flag
     * @param value The value of the flag we want to set
     * @throws exceptions.DatabaseException
     */
    public void setServerAuthMode(String username, boolean value) throws DatabaseException;
     /**
     * This method is used to check the value of the configuration flag of the for the server authentication mode
     * 
     * @param username The username for which we want to check the value of the the server authentication mode flag
     * @return The value of the flag
     * @throws exceptions.DatabaseException
     */
    public boolean getServerAuthMode(String username) throws DatabaseException;
    /**
     * This method is used to delete the configuration of a specified user
     * 
     * @param username The username of the user whom configuration will be deleted
     */
    public void removeConfiguration(String username);
}
